home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / devel / mildred / lha / dissolvedemo.lha / DissolveTest.ascii next >
Text File  |  1998-11-28  |  2KB  |  68 lines

  1. WBStartup
  2.  
  3. ; This is a program to demonstrate how you can use MPictureDissolveIn to
  4. ; show a picture in a previously empty display, or dissolve a new picture
  5. ; into an existing one (same palette!).
  6.  
  7. ; Choose a normal ILBM picture up to 256 colours for the source, and then
  8. ; choose an ILBM `effect' picture the same size.
  9.  
  10. MReservec2pWindows 1
  11. MReserveBitmaps 3
  12.  
  13. MCPU Processor
  14. Mc2pCPUmode Processor
  15.  
  16. #Width=320 ; Width of operation
  17. #Height=240 ; Height of operation
  18. #EffectColours=128 ; Number of colours to use in effect bitmap (0..This). More colours means slower dissolve.
  19.  
  20. InitBank 0,Max(320,#Width)*#Height,$10002 ; Chipmem
  21. CludgeBitMap 0,Max(320,#Width),#Height,8,Bank(0)
  22. InitPalette 0,256
  23.  
  24. MaxLen ASLfile$=256
  25. MaxLen ASLpath$=256
  26. ASLpath$="Work:Test/"
  27. FindScreen 0
  28. Pic$=ASLFileRequest$("Choose an ILBM picture",ASLpath$,ASLfile$)
  29. LoadIFF Pic$,0,0 ; Source
  30. If MBitmap(0,#Width,#Height)=0 Then End
  31. ResetTimer
  32. MPlanar16ToBitmap 0,Bank(0)
  33. NPrint Timer
  34. MBitmap 2,#Width,#Height
  35.  
  36. ;Take out these three lines for a fade in from nothing
  37. MBlockScroll 0,0,#Width,#Height,0,0,0
  38. MBitmapYFlip 2
  39. MBitmapXFlip 2
  40.  
  41. Cls 0
  42. Pic$=ASLFileRequest$("Choose an ILBM effect picture",ASLpath$,ASLfile$)
  43. LoadIFF Pic$,0 ; Effect
  44. If MBitmap(1,#Width,#Height)=0 Then End
  45. ResetTimer
  46. MPlanar16ToBitmap 1,Bank(0)
  47. NPrint Timer
  48. Cls 0
  49. Mc2pWindow 0,#Width,#Height,#Width,Processor,#Width,#Height
  50. MUseBitmaps 0,2 ; Dest is 2
  51. Screen 0,0,0,Max(320,#Width),#Height,8,0,"",0,0,0
  52. ShowPalette 0
  53. Mc2p 0,NPeekL(MAddrBitmap(2)+8),Bank(0)
  54. VWait 25
  55. ResetTimer
  56. For c=0 To #EffectColours-1
  57.   MPictureDissolveIn 1,c
  58.   Mc2p 0,NPeekL(MAddrBitmap(2)+8),Bank(0)
  59. Next c
  60. t=Timer
  61. ScreenToBack_ NPeekL(Addr Screen(0))
  62. a.q=50.0/(t/#EffectColours)
  63. NPrint "Displayed at ",a," frames per second."
  64. NPrint "Press mouse..."
  65. MouseWait
  66. End
  67.  
  68.